package com.wg.controller;

import com.wg.pojo.Resource;
import com.wg.service.ResourceService;
import com.wg.vo.SearchResult;
import com.wg.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.security.sasl.SaslServer;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/search")
public class ResourceController {
    @Autowired
    private ResourceService resourceService;
    @GetMapping("/getList")
    public SysResult getList(SearchResult searchResult){
        searchResult = resourceService.getList(searchResult);
        return SysResult.success(searchResult);
    }

    @GetMapping("/gethotList")
    public List<Resource> gethotList(){
        return resourceService.gethotList();


    }

    @GetMapping("/getdynamicList/{resourceTitle}")
    public List<Resource> getdynamicList(@PathVariable String resourceTitle){
        return resourceService.getdynamicList(resourceTitle);
    }
}
